package com.wtwd.campus.attendancenetty;


import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;

public class ServerChannelInitializer extends ChannelInitializer<Channel> {
    @Override
    protected void initChannel(Channel channel) throws Exception {
        // 编解码处理
        channel.pipeline().addLast("decoder",new MessageDecoder2());
        channel.pipeline().addLast("encoder",new MessageEncoder());
        //经过编码解码处理后，收到的bytebuf已经变成自己的bean了，这个handler的先后顺序有讲究的，除非把资源释放，后面的handler才能拿到
        channel.pipeline().addLast(new ServerIdleHandler());
        channel.pipeline().addLast(new ServerHandler());
    }
}